/*
 * @Title: 我的行程
 * @Created by: gsjPC 
 */
<template>
	<scroll-view scroll-y="true" class="scrollHeight">
		<myroute-con v-if="timeAxisIndex == 0"></myroute-con>
		<time-axis v-if="timeAxisIndex == 1"></time-axis>
		<!-- 推荐喜欢 -->
		<view class="botmPad">
			<view class="tjTitle">
				<image src="/static/tjLine.png"></image>
				<image src="/static/tuijianIco.png"></image>
				<text>推荐你喜欢的</text>
				<image src="/static/tjLine.png"></image>
			</view>
			<nairenk-waterfall-flow  :list="list" :loading="loading" @click="choose"></nairenk-waterfall-flow>
		</view>
		
	</scroll-view>
</template>

<script>
	import myrouteCon from './myRouteCon'
	import timeAxis from './timeAxis'
	import nairenkWaterfallFlow from '@/components/nairenk-waterfall-flow/nairenk-waterfall-flow'
	const data = require('../../../common/data.json');
	export default{
		props:{
			timeAxisIndex:{
				type:Number
			}
		},
		components:{
			nairenkWaterfallFlow,
			timeAxis,
			myrouteCon
		},
		data(){
			return{
				page: 1,
				start: 0,
				list: [], // 列表
				end: 0,
				loading: true,
				animationHeight:0,
			
			}
		},
		methods:{
			choose(item) {
			  	// item 返回选中 JSON 对象
			  	console.log(item)
			  },
			// 模拟加载数据
			getList() {
				if (this.list.length < data.list.length) {
					setTimeout(() => {
						this.end = this.page * 10;
						this.list = this.list.concat(data.list.slice(this.start, this.end));
						this.start = this.end;
						// 延迟 120 毫秒隐藏加载动画，为了跟组件里面的 100 毫秒定位有个平缓过度
						setTimeout(() => {
							this.loading = false;
						}, 120);
					}, 1000)
				} else {
					this.loading = false;
				}
			},
		
		},
		mounted(){
			  this.getList();
			
		},
		onReachBottom() {
			this.page++;
			this.loading = true;
			this.getList();
		},
		
	}
</script>

<style>
	.scrollHeight{
		height: 100%;
	}
	
	/* 推荐你喜欢的 */
	.botmPad{
		padding-bottom: 150upx;
	}
	.tjTitle {
		margin: 62upx auto 46upx auto;
		text-align: center;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
	}
	.tjTitle{
		color: #BDBDBD;
		font-size: 30upx;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
	}
	.tjTitle image:nth-of-type(1){
		width:81upx;
		height: 15upx;
		margin-right:20upx;
	}
	.tjTitle image:nth-of-type(2){
		width:37upx;
		height: 37upx;
		margin-right: 12upx;
		margin-top: -20upx;
	}
	.tjTitle image:nth-of-type(3){
		width:81upx;
		height: 15upx;
		transform: rotateY(180);
		margin-left:45upx;
	}

</style>
